package com.foreveross.crawl.common.application;

import java.io.Serializable;
import java.util.List;

import com.foreveross.crawl.common.InstanceFactory;
import com.foreveross.crawl.common.domain.IBaseEntity;
import com.foreveross.crawl.common.jpa.IBaseRepository;

public abstract class BaseApplicationImpl implements IBaseApplication {

	
	@Override
	public <T extends IBaseEntity> List<T> listAll(Class<T> clazz) throws Exception {
		IBaseRepository baseRepository	= clazz.newInstance().getBaseEntityRepository();
		return baseRepository.findAll(clazz);
	}

	@Override
	public <T extends IBaseEntity> T find(Class<T> clazz, Serializable id) throws Exception {
		return InstanceFactory.getInstance(clazz, id);
	}


	
}
